#pragma once
#include "IPAddress.h"
#include "array/Array.hpp"

namespace yzrilyzr_net{
	ECLASS(IP4Address,public IPAddress){
	protected:
	int32_t val=0;
	public:
	IP4Address()=default;
	IP4Address(const yzrilyzr_array::ByteArray &fromBytes);
	IP4Address(int32_t maskLength, int32_t netAddr);
	int32_t hashCode()const override;
	bool operator==(const IP4Address & other)const;
	bool inRange(const IPAddress * targetRange)const override;
	yzrilyzr_lang::String toFullString()const override;
	yzrilyzr_lang::String toMaskedString()const override;
	std::shared_ptr<IPAddress> toMasked(int32_t maskLength)const override;
	std::shared_ptr<IPAddress> clone()const override;
	std::shared_ptr<yzrilyzr_array::ByteArray> toByte()const override;
	void fromByte(const yzrilyzr_array::ByteArray & b)override;
	yzrilyzr_lang::String toSimpleString()const override;

	int getVersion()const override;
	
	static std::shared_ptr<IP4Address> parse(const yzrilyzr_lang::String &str);
	static std::shared_ptr<IP4Address> LOCAL_HOST;
	static std::shared_ptr<IP4Address> ANY_ADDRESS;
	};
}